/** Header file for planet destruction
*	Created 17.9.2009 by Raymond; common.h massacre
*	*/
#ifndef GAME_H
#define GAME_H

#include "databank.h"
#include "view.h"
#include "common.h"

class Weapon;

enum TurnPart {
	TURN_PLAYER, TURN_WEAPON, TURN_SHOT, TURN_PARTICLE
};



/** The "heart" of the game, everything is controlled from here */ 
class GameModule {
	DataBank *dataBank;
	ViewModule *view;
	Weapon *curWeapon;
	Player *curPl;
public:
	int curPlayer;
	bool frameUpdate;
	bool demo;
	TurnPart turnStatus;
	GameType gameType;
    double restTimer;
	
	double endTimer;
    double speedTimer;
    double deltaAvg;
    int frameCount;
    int fpsCounter;
    double delta;
	
	GameModule() { }
	DataBank *getData() { return dataBank; }
	ViewModule *getView() { return view; }
	/** Runs the show, only called once from main() */
	void run();
	void nextPlayer();
	void turnRevolve();
	bool gameOver(GameType gt);
	
	void newGame(GameType gt);
	void setupGame(void);
	
	void updateTimer();
	
	int init();
};

#endif

